package com.sz.common.core.system.service.impl;

import com.sz.common.base.dao.ParamData;
import com.sz.common.base.service.AbstractService;
import com.sz.common.core.system.entity.SysTemplate;
import com.sz.common.core.system.service.SysTemplateService;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Function: SysTemplateServiceImpl <br>
 * Author: penghui.zheng <br>
 * Date: 2017-8-2 12:04:00
 */
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class SysTemplateServiceImpl extends AbstractService implements SysTemplateService {

	/**
	 * 获取模板路径
	 * 
	 * @param type
	 * @param owner
	 * @param projectId
	 * @param templateName
	 * @return
	 */
	@Override
	public String getTemplatePath(int type, int owner, int projectId, String templateName) {
		String path="";
		ParamData pd = new ParamData();
		pd.put("type", type);
		pd.put("owner", owner);
		pd.put("projectId", projectId);
		pd.put("templateName", templateName);
		SysTemplate sysTemplate = (SysTemplate) this.dao.findForObject(getSqlName("getTemplatePath"), pd);
		if(sysTemplate!=null){
			path=sysTemplate.getPath();
		}
		return path;
	}

	@Override
	protected String getMapperNamespace() {
		return "sysTemplateMapper";
	}
}
